# -*- coding: utf-8 -*-
# adminPages.py
from flask import Blueprint,render_template,request,redirect
#from tasks import sendmail
from tasks_2 import sendmail

admin = Blueprint('admin', __name__)

@admin.route('/')
def admin_index():
    pon='kkkk'
    return render_template('admin/index.html',pon=pon)

#发邮件
@admin.route('/send/',methods=['GET','POST'])
def admin_sendmail():
    if request.method=='GET':
        return render_template('admin/send.html')

    if request.method=='POST':
        email=request.form.get('email')
        if email:
            #tasks.sendmail({'to':email})
            ret=sendmail.delay({'to': email})
            print ret
        return redirect('/admin/')

@admin.route('/page/')
def admin_pages():
    pass

@admin.route('/page/new/')
def new_page():
    pass

@admin.route('/page/edit/')
def edit_page():
    pass